package com.tailyou.androidlearning202400.act

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.navigation.Navigation
import androidx.navigation.Navigation.findNavController
import androidx.navigation.ui.NavigationUI
import com.google.android.material.bottomnavigation.BottomNavigationView
import com.tailyou.androidlearning202400.R

class MainActivity_XXT : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContentView(R.layout.activity_main_xxt)
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
            val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
            insets
        }
        // 找到对应的BottomNavigationView
        val navView = findViewById<BottomNavigationView>(R.id.nav_view)
        // 找到fragment（包含4个Fragment）
        val navController = findNavController(this, R.id.nav_host_fragment_activity_tab_host)
        // 绑定BottomNavigationView和fragment
        NavigationUI.setupWithNavController(navView, navController)
    }
}